xen.git
14 years agox86/mca: simplify mce action, and some update of mem err handler for
Liu, Jinsong [Mon, 16 May 2011 12:12:03 +0000 (13:12 +0100)]
x86/mca: simplify mce action, and some update of mem err handler for
future SRAR extension

This patch simplify mce_action(). Basically the 2 set of mce status
flags MCA_... and MCER_... are highly functional similar. This patch
remove the redundant middle-level flag MCA_..., and its related data
structure and function, so that mce_action() logic is more clean and
simpler.  This patch also update mem err
handler. intel_memerr_dhandler() will be commonly used by SRAO and
SRAR, so for the extension of future SRAR case, this patch remove the
default fail flag from intel_memerr_dhandler() outside to SRAO/SRAR
level, since only SRAO/SRAR handler itself has the knowledge of how to
handle the failure when mem err handler fail.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agox86: Check for valid pirq values in hvm_domain_use_pirq
Stefano Stabellini [Thu, 12 May 2011 15:42:54 +0000 (16:42 +0100)]
x86: Check for valid pirq values in hvm_domain_use_pirq

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agovt-d: [CVE-2011-1898] Ensure that "iommu=required" enables interrupt remapping.
Keir Fraser [Thu, 12 May 2011 15:42:00 +0000 (16:42 +0100)]
vt-d: [CVE-2011-1898] Ensure that "iommu=required" enables interrupt remapping.

Ensure that when Xen boots with "iommu=required" it will also insist
that interrupt remapping is supported and enabled.  It arranges that
booting with that option on vulnerable hardware will fail, rather than
appearing to succeed but actually being vulnerable to guests.

From: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86, vtd: [CVE-2011-1898] Protect against malicious MSIs from untrusted devices.
Keir Fraser [Thu, 12 May 2011 15:39:31 +0000 (16:39 +0100)]
x86, vtd: [CVE-2011-1898] Protect against malicious MSIs from untrusted devices.

In the absence of VT-d interrupt remapping support, a device can send
arbitrary APIC messages to host CPUs. One class of attack that results
is to confuse the hypervisor by delivering asynchronous interrupts to
vectors that are expected to handle only synchronous
traps/exceptions.

We block this class of attack by:
(1) setting APIC.TPR=0x10, to block all interrupts below vector
0x20. This blocks delivery to all architectural exception vectors.
(2) checking APIC.ISR[vec] for vectors 0x80 (fast syscall) and 0x82
(hypercall). In these cases we BUG if we detect we are handling a
hardware interrupt -- turning a potentially more severe infiltration
into a straightforward system crash (i.e, DoS).

Thanks to Invisible Things Lab <http://www.invisiblethingslab.com>
for discovery and detailed investigation of this attack.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86/hvm: Use UNLIKELY_{START,END} in a few suitable places in asm.
Keir Fraser [Thu, 12 May 2011 08:33:59 +0000 (09:33 +0100)]
x86/hvm: Use UNLIKELY_{START,END} in a few suitable places in asm.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86/hvm: pv-on-hvm: fix de/assert_irq checks
Stefano Stabellini [Thu, 12 May 2011 08:15:05 +0000 (09:15 +0100)]
x86/hvm: pv-on-hvm: fix de/assert_irq checks

The checks in assert_irq and deassert_irq to distinguish interrupts
that have been remapped onto event channels from the others that have
to be injected using the emulated lapic are wrong.

Fix the condition checks using the convenient hvm_domain_use_pirq
function.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
14 years agohvm: vpmu: Enable HVM VPMU for AMD Family 12h and 14h processors
Jacob Shin [Thu, 12 May 2011 08:14:06 +0000 (09:14 +0100)]
hvm: vpmu: Enable HVM VPMU for AMD Family 12h and 14h processors

HVM VPMU support can be enabled for AMD Family 12h and 14h processors
by taking the same code path as 10h.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
14 years agox86: use compat hypercall handlers for calls from 32-bit HVM guests
Tim Deegan [Thu, 12 May 2011 08:13:18 +0000 (09:13 +0100)]
x86: use compat hypercall handlers for calls from 32-bit HVM guests

On 64-bit Xen, hypercalls from 32-bit HVM guests are handled as
a special case, but not all the hypercalls are corrently redirected
to their compat-mode wrappers.  Use compat_* for xen_version,
sched_op and set_timer_op for consistency.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agonestedsvm: fix shadow-on-hap
Christoph Egger [Thu, 12 May 2011 08:07:35 +0000 (09:07 +0100)]
nestedsvm: fix shadow-on-hap

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agonestedsvm: update rip on invlpga intercept
Christoph Egger [Thu, 12 May 2011 08:00:46 +0000 (09:00 +0100)]
nestedsvm: update rip on invlpga intercept

Fixes endless loop.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agonestedsvm: fix error path when VMRUN emulation fails
Christoph Egger [Thu, 12 May 2011 07:58:02 +0000 (08:58 +0100)]
nestedsvm: fix error path when VMRUN emulation fails

With this, l1 guest keeps alive rather crashing the host.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agonestedsvm: fix host crash with pv-on-hvm Linux KVM guest
Christoph Egger [Thu, 12 May 2011 07:57:08 +0000 (08:57 +0100)]
nestedsvm: fix host crash with pv-on-hvm Linux KVM guest

Nested SVM was unaware of the HVM direct vector eventchn mechanism.
Attached patch fixes a host crash when starting a KVM L2 guest on a
pv-on-hvm L1 Linux guest (e.g., HVM Debian Squeeze domU).

Signed-off-by: Uwe Dannowski <Uwe.Dannowski@amd.com>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agotools/xm-test: portability fix: Avoid using == in /bin/sh script
Christoph Egger [Thu, 12 May 2011 07:55:12 +0000 (08:55 +0100)]
tools/xm-test: portability fix: Avoid using == in /bin/sh script

From: David Brownlee <abs@netbsd.org>
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
14 years agox86/mca: MCA bank clear
Liu, Jinsong [Thu, 12 May 2011 07:53:42 +0000 (08:53 +0100)]
x86/mca: MCA bank clear

1). Add explicitly uc=pcc=1 fatal error detect, since under such case
the s/ar/over bits status is undefined and hence may be
mis-cleaned. Explicit fatal detect return 0 indicate stick MSR bank
will have chance to be handled after reboot by polling;
2). Fix a little bug for case SRAR, over bit should be 0 when need
clear bank, otherwise it would reset system;
3). When clear bank, add clear MCi_ADDR/MISC if it's valid, according
to Intel SDM;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agox86/mca MCA minor bugfix
Liu, Jinsong [Thu, 12 May 2011 07:52:47 +0000 (08:52 +0100)]
x86/mca MCA minor bugfix

This patch fix a minor bug, when in xen context and cannot safely
return the mce break point, reset system;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agox86/mca: MCA physical address check when calculate domain
Liu, Jinsong [Thu, 12 May 2011 07:52:18 +0000 (08:52 +0100)]
x86/mca: MCA physical address check when calculate domain

Bank addr maybe invalid, or Bank addr maybe physical/memory/linear
address or segment offset.  This patch add mca
MCi_STATUS_MISCV/MCi_STATUS_ADDRV check, and add physical address
verify, so that it work safe when calculate domain.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agoSimplify and build-fix (for some gcc versions) radix_tree_int_to_ptr().
Keir Fraser [Wed, 11 May 2011 11:58:04 +0000 (12:58 +0100)]
Simplify and build-fix (for some gcc versions) radix_tree_int_to_ptr().

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86/mm/p2m: break into common, pt-implementation and pod parts.
Tim Deegan [Fri, 6 May 2011 10:15:35 +0000 (11:15 +0100)]
x86/mm/p2m: break into common, pt-implementation and pod parts.

Start to make a clearer distinction between generic p2m functions and
the implementation of the datastructure as an x86 pagetable.
Also move the EPT datastructure implementation into x86/mm/ to match,
and split the PoD admin code into its own file.

This is just code motion, except for splitting the p2m_initialise
function into a pt-specific part and a common part.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agolibxc: [CVE-2011-1583] pv kernel image validation
Ian Jackson [Mon, 9 May 2011 14:00:57 +0000 (15:00 +0100)]
libxc: [CVE-2011-1583] pv kernel image validation

The functions which interpret the kernel image supplied for a
paravirtualised guest, and decompress it into memory when booting the
domain, are incautious.  Specifically:

 (i) Integer overflow in the decompression loop memory allocator might
    result in overrunning the buffer used for the decompressed image;
 (ii) Integer overflows and lack of checking of certain length fields
    can result in the loader reading its own address space beyond the
    size of the supplied kernel image file.
 (iii) Lack of error checking in the decompression loop can lead to an
    infinite loop.

This patch fixes these problems.

CVE-2011-1583.

Signed-off-by: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agox86/mca: MCA handler extension
Liu, Jinsong [Mon, 9 May 2011 10:43:58 +0000 (11:43 +0100)]
x86/mca: MCA handler extension

Add intel_srao_check for future SRAR extension;
Add a wrapper to SRAO handler to make it more extensible for future
SRAO error-code types;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agox86/mca: MCA trivial cleanup
Liu, Jinsong [Mon, 9 May 2011 10:43:26 +0000 (11:43 +0100)]
x86/mca: MCA trivial cleanup

1) A little cleanup for mce_action(), remove redundant input param;
2) result should be MCA_NEED_RESET instead of MCA_RESET, otherwise
system cannot reset when fatal;

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agox86/mca: MCA bank extension
Liu, Jinsong [Mon, 9 May 2011 10:42:45 +0000 (11:42 +0100)]
x86/mca: MCA bank extension

Current mca_summay use uint32_t as bitmask of bank uc/pcc/recoverable.
It's not extensible, support no more than 32 mca banks, while
according to Intel SDM, bank number could be as much as 256.

This patch use bool_t flag since it only need to record and indicate
the most severity case.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
14 years agox86/LWP: Add LWP support for SVM guests
Wei Huang [Mon, 9 May 2011 10:40:42 +0000 (11:40 +0100)]
x86/LWP: Add LWP support for SVM guests

This patch enables SVM to handle LWP related MSRs and CPUID. It
intercepts guests read/write to LWP_CFG. It also save/restore LWP_CFG
when guests touch this MSR. The LWP_CBADDR MSR is not intercepted
because this MSR is handled by xsave/xrstor.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86/LWP: export LWP related CPUID to AMD SVM guest
Wei Huang [Mon, 9 May 2011 10:40:05 +0000 (11:40 +0100)]
x86/LWP: export LWP related CPUID to AMD SVM guest

This patch exposes LWP CPUID 0x8000001C to SVM guests.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86/fpu: create lazy and non-lazy FPU restore functions
Wei Huang [Mon, 9 May 2011 10:39:23 +0000 (11:39 +0100)]
x86/fpu: create lazy and non-lazy FPU restore functions

Currently Xen relies on #NM (via CR0.TS) to trigger FPU context
restore. But not all FPU state is tracked by TS bit. This function
creates two FPU restore functions: vcpu_restore_fpu_lazy() and
vcpu_restore_fpu_eager(). vcpu_restore_fpu_lazy() is still used when
#NM is triggered. vcpu_restore_fpu_eager(), as a comparision, is
called for vcpu which is being scheduled in on every context
switch. To minimize restore overhead, it creates a flag,
nonlazy_xstate_used, to control non-lazy restore.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86/fpu: add mask parameter to xsave and xrstor
Wei Huang [Mon, 9 May 2011 10:38:55 +0000 (11:38 +0100)]
x86/fpu: add mask parameter to xsave and xrstor

Xen currently sets mask bits of xsave() and xrstor() to all 1's. This
patch adds a mask option to xsave() and xrstor().

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86/fpu: clean up FPU context restore function
Wei Huang [Mon, 9 May 2011 10:38:30 +0000 (11:38 +0100)]
x86/fpu: clean up FPU context restore function

This patch cleans up context restore function. It renames the function
name to vcpu_restore_fpu(). It also extracts FPU restore code (frstor,
fxrstor, xrstor) out into seperate functions. vcpu_restor_fpu() will
dispatch to these functions depending on CPU's capability.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86/fpu: clean up FPU context save function
Wei Huang [Mon, 9 May 2011 10:38:04 +0000 (11:38 +0100)]
x86/fpu: clean up FPU context save function

This patch cleans up context save function. It renames the save
function to vcpu_save_fpu() because existing function name is
confusion. It also extracts FPU context save code (fsave, fxsave,
xsave) into seperate functions. vcpu_save_fpu() will call
corresponding sub-function depending on CPU's capability.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86/fpu: create FPU init and destroy functions
Wei Huang [Mon, 9 May 2011 10:37:36 +0000 (11:37 +0100)]
x86/fpu: create FPU init and destroy functions

Extract FPU initialization and destroy code into two functions. These
functions handle memory allocation/deallocation for FPU context.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agox86/fpu: extract extended related code into xstate.h and xstate.c
Wei Huang [Mon, 9 May 2011 10:37:03 +0000 (11:37 +0100)]
x86/fpu: extract extended related code into xstate.h and xstate.c

Current extended code is mixing with FPU code in i387.c. As part of
FPU code cleanup, this patch moves all extended state code into
independent files. Not much semantic are changed and most function
names are kept untouched, except for xsave() and xsaveopt(). These two
functions are combined into a single function.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
14 years agoxentrace: Remove unneeded cast when assigning pointer value to dst
Olaf Hering [Mon, 9 May 2011 08:59:50 +0000 (09:59 +0100)]
xentrace: Remove unneeded cast when assigning pointer value to dst

Remove unneeded cast when assigning pointer value to dst.
Both arrays are uint32_t and memcpy takes a void pointer.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
14 years agoxentrace: Mark data_size __read_mostly because it's only written once
Olaf Hering [Mon, 9 May 2011 08:59:13 +0000 (09:59 +0100)]
xentrace: Mark data_size __read_mostly because it's only written once

Signed-off-by: Olaf Hering <olaf@aepfle.de>
14 years agoxentrace: Move the global variable t_info_first_offset into calculate_tbuf_size()
Olaf Hering [Mon, 9 May 2011 08:58:36 +0000 (09:58 +0100)]
xentrace: Move the global variable t_info_first_offset into calculate_tbuf_size()

Move the global variable t_info_first_offset into
calculate_tbuf_size() because it is only used there. Change the type
from u32 to uint32_t to match type in other places.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
14 years agotools/tests/xen-access: minor bug fixes
Aravindh Puthiyaparambil [Mon, 9 May 2011 08:56:39 +0000 (09:56 +0100)]
tools/tests/xen-access: minor bug fixes

Fix a couple of minor bugs in xen-access test program:
 * Fix -m option handling.
 * Fix a segfault that was occurring during program exit.

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
14 years agohvm: vpmu: Add support for AMD Family 15h processors
Jacob Shin [Mon, 9 May 2011 08:54:46 +0000 (09:54 +0100)]
hvm: vpmu: Add support for AMD Family 15h processors

AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates HVM VPMU
to take advantage of the new counters.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
14 years agoxenoprof: Add support for AMD Family 15h processors
Jacob Shin [Mon, 9 May 2011 08:53:07 +0000 (09:53 +0100)]
xenoprof: Add support for AMD Family 15h processors

AMD Family 15h CPU mirrors legacy K7 performance monitor counters to
a new location, and adds 2 new counters. This patch updates xenoprof
to take advantage of the new counters.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Rename fam15h -> amd_fam15h in a few places, as suggested by Jan
Beulich.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agoxenoprof: Update cpu_type to sync with upstream oprofile
Jacob Shin [Mon, 9 May 2011 08:49:14 +0000 (09:49 +0100)]
xenoprof: Update cpu_type to sync with upstream oprofile

Update xenoprof's cpu_type to match upstream oprofile. Currently AMD
Family 11h ~ Family 15h are broken due to string mismatches.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
14 years agomisc cpufreq cleanup
Jan Beulich [Mon, 9 May 2011 08:46:02 +0000 (09:46 +0100)]
misc cpufreq cleanup

- proper handling of governor command line options when using the
  default governor
- warning message for unrecognized command line options
- replacing a NR_CPUS sized array with per-CPU data
- a couple of __read_mostly annotations

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: replace nr_irqs sized per-domain arrays with radix trees
Jan Beulich [Mon, 9 May 2011 08:27:42 +0000 (09:27 +0100)]
x86: replace nr_irqs sized per-domain arrays with radix trees

It would seem possible to fold the two trees into one (making e.g. the
emuirq bits stored in the upper half of the pointer), but I'm not
certain that's worth it as it would make deletion of entries more
cumbersome. Unless pirq-s and emuirq-s were mutually exclusive...

v2: Split setup/teardown into two stages - (de-)allocation (tree node
(de-)population) is done with just d->event_lock held (and hence
interrupts enabled), while actual insertion/removal of translation
data gets done with irq_desc's lock held (and interrupts disabled).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Fix up for new radix-tree implementation. In particular, we should
never insert NULL into a radix tree, as that means empty slot (which
can be reclaimed during a deletion). Make use of
radix_tree_int_to_ptr() (and its inverse) to hide some of these
details.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agoUpdate radix-tree.[ch] from upstream Linux to gain RCU awareness.
Keir Fraser [Mon, 9 May 2011 08:25:23 +0000 (09:25 +0100)]
Update radix-tree.[ch] from upstream Linux to gain RCU awareness.

We still leave behind features we don't need such as tagged nodes.

Other changes:
 - Allow callers to define their own node alloc routines.
 - Only allocate per-node rcu_head when using the default RCU-safe
   alloc routines.
 - Keep our own radix_tree_destroy().

In future it may also be worth getting rid of the complex and
pointless special-casing of radix-tree height==0, in which a single
data item can be stored directly in radix_tree_root. It introduces a
whole lot of special cases and complicates RCU handling. If we get rid
of it we can reclaim the 'indirect pointer' tag in bit 0 of every slot
entry.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86/mm: don't treat entirely empty p2m entries as RAM.
Tim Deegan [Thu, 5 May 2011 16:40:34 +0000 (17:40 +0100)]
x86/mm: don't treat entirely empty p2m entries as RAM.

The AMD IOMMU pagetable-sharing code switched p2m type 0 to be
r/w RAM rather than invalid.  Be more careful when translating
from PTEs to p2m types that we don't treat all-zeros as a
RAM mapping of frame zero.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agoxl: refactor common parts of command line parsing
Andre Przywara [Wed, 4 May 2011 13:46:32 +0000 (14:46 +0100)]
xl: refactor common parts of command line parsing

xl command options are currently handled in each command's sub function,
leading to a lot of duplicate code.

This patch moves the common part of it into a separate function,
which handles the help switch, unknown options and an insufficient
number of parameters. This removes a lot of redundant code.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
14 years agox86/mm: add HVMOP_get_mem_type hvmop
Olaf Hering [Wed, 4 May 2011 12:37:58 +0000 (13:37 +0100)]
x86/mm: add HVMOP_get_mem_type hvmop

The balloon driver in the guest frees guest pages and marks them as
mmio. When the kernel crashes and the crash kernel attempts to read the
oldmem via /proc/vmcore a read from ballooned pages will generate 100%
load in dom0 because Xen asks qemu-dm for the page content. Since the
reads come in as 8byte requests each ballooned page is tried 512 times.

Add a new hvmop HVMOP_get_mem_type to return the hvmmem_type_t for the
given pfn. Pages which are neither ram or mmio will be HVMMEM_mmio_dm.
This interface enables the crash kernel to skip ballooned pages.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agoRevert 23295:4891f1f41ba5 and 23296:24346f749826
Keir Fraser [Mon, 2 May 2011 11:00:40 +0000 (12:00 +0100)]
Revert 23295:4891f1f41ba5 and 23296:24346f749826

Fails current lock checking mechanism in spinlock.c in debug=y builds.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agoreplace d->nr_pirqs sized arrays with radix tree
Jan Beulich [Sun, 1 May 2011 12:17:44 +0000 (13:17 +0100)]
replace d->nr_pirqs sized arrays with radix tree

With this it is questionable whether retaining struct domain's
nr_pirqs is actually necessary - the value now only serves for bounds
checking, and this boundary could easily be nr_irqs.

Another thing to consider is whether it's worth storing the pirq
number in struct pirq, to avoid passing the number and a pointer to
quite a number of functions.

Note that ia64, the build of which is broken currently anyway, is only
partially fixed up.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: replace nr_irqs sized per-domain arrays with radix trees
Jan Beulich [Sun, 1 May 2011 12:16:30 +0000 (13:16 +0100)]
x86: replace nr_irqs sized per-domain arrays with radix trees

It would seem possible to fold the two trees into one (making e.g. the
emuirq bits stored in the upper half of the pointer), but I'm not
certain that's worth it as it would make deletion of entries more
cumbersome. Unless pirq-s and emuirq-s were mutually exclusive...

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agopublic/arch-ia64/debug_op.h: Reinsert copyright that I accidentally deleted.
Keir Fraser [Sun, 1 May 2011 12:03:37 +0000 (13:03 +0100)]
public/arch-ia64/debug_op.h: Reinsert copyright that I accidentally deleted.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86: a little bit of cleanup to time.c
Jan Beulich [Sun, 1 May 2011 09:20:44 +0000 (10:20 +0100)]
x86: a little bit of cleanup to time.c

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: clean up building in mm/hap/
Jan Beulich [Sun, 1 May 2011 09:16:54 +0000 (10:16 +0100)]
x86: clean up building in mm/hap/

Building 4-level guest walks is unnecessary for x86-32, and with this
no longer being built the fallback code used here isn't necessary
anymore either.

Additonally the mechanism to determine the value of
GUEST_PAGING_LEVELS to be passed to the compiler can be much
simplified given that we're using a pattern rule here.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agoA little bit of SMP boot code cleanup
Jan Beulich [Sun, 1 May 2011 09:15:11 +0000 (10:15 +0100)]
A little bit of SMP boot code cleanup

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agox86: set ARAT feature flag for non-buggy AMD CPUs
Jan Beulich [Sun, 1 May 2011 09:14:15 +0000 (10:14 +0100)]
x86: set ARAT feature flag for non-buggy AMD CPUs

This is the equivalent of a recent Linux change.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
14 years agomini-os: fix lib.h licence
Samuel Thibault [Sun, 1 May 2011 09:11:58 +0000 (10:11 +0100)]
mini-os: fix lib.h licence

Update the Linux stdio functions prototypes, and move them to a
separate header, licenced under GPL2+.  Import FreeBSD8 string
functions prototypes, update licence.  Drop kvec, of unsure source and
useless anyway.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agomini-os: lib/math.c: import FreeBSD 8 functions
Samuel Thibault [Sun, 1 May 2011 09:10:12 +0000 (10:10 +0100)]
mini-os: lib/math.c: import FreeBSD 8 functions

Import lib/math.c functions (and thus licence) from FreeBSD 8,
and re-apply a few of our changes. Whitespaces left aside, this
leads to almost no source change except s/int64_t/quad_t/ and
s/uint64_t/u_quad_t/.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agomini-os: Fix printf.c licence
Samuel Thibault [Sun, 1 May 2011 09:09:47 +0000 (10:09 +0100)]
mini-os: Fix printf.c licence

Changeset df1348e72390 actually completely replaced the freebsd printf
implementation with the Linux printf implementation. Further changes
are extremely minor and thus don't pose IP issue. Fix the licence
accordingly.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agoClean up licensing in the public header directory.
Keir Fraser [Sun, 1 May 2011 09:08:40 +0000 (10:08 +0100)]
Clean up licensing in the public header directory.

The COPYING file at xen/include/public/COPYING clearly states that all
public header files are distributed under a permissive MIT
license. Therefore make sure the same permissive license is included
at the top of every header file (i.e., not GPL).

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86: Clean up smp_call_function handling.
Keir Fraser [Sun, 1 May 2011 08:32:48 +0000 (09:32 +0100)]
x86: Clean up smp_call_function handling.

We don't need so many communication fields between caller and
handler.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86: Remove TRAP_INSTR from the public headers.
Keir Fraser [Sat, 30 Apr 2011 08:48:16 +0000 (09:48 +0100)]
x86: Remove TRAP_INSTR from the public headers.

Direct hypercall traps (rather than using the hypercall transfer page)
was long obsolete even when TRAP_INSTR was deprecated in the API
headers. No current guest will be, or should be, using TRAP_INSTR.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86: Remove direct uses of 0x82 as HYPERCALL_VECTOR.
Keir Fraser [Sat, 30 Apr 2011 08:46:46 +0000 (09:46 +0100)]
x86: Remove direct uses of 0x82 as HYPERCALL_VECTOR.

We have a macro; we should use it.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agotools: ocaml: autogenerate xl datatype definitions and ocaml<->C conversion
Ian Campbell [Wed, 20 Apr 2011 16:13:08 +0000 (17:13 +0100)]
tools: ocaml: autogenerate xl datatype definitions and ocaml<->C conversion

The method by which ocaml converts between ocaml types and C
datastructures is based around explicit matching of field indexes
within the ocaml data type to C structure members which is error prone
to write and fragile to maintain (as evidenced by the difference
between the existing hand coded support and the autogenerated code
which shows how out of date the ocaml bindings have
become). Autogenerating these types should reduce these problems.

There is a short list of types which are blacklisted and not
autogenerated because I expect them to change significantly in the
future due to changes to the IDL type (fixing up the TaggedUnion
class) so I didn't want to spend the time to implement the necessary
autogenerator features just yet..

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: lay ground work for auto generating xl datatypes.
Ian Campbell [Wed, 20 Apr 2011 16:13:08 +0000 (17:13 +0100)]
tools: ocaml: lay ground work for auto generating xl datatypes.

Doesn't actually generate anything yet but puts all the moving parts
into place. In particular sets up the
xl.ml.in+_libxl_types.ml.in->xl.ml transformation using sed. This
appears to be the only/best way to do this for ocaml due to the lack
of a preprocessor and/or an include mechanism which has an inmpact on
namespacing.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: tweak whitespace in preparation for autogenerating xl bindings
Ian Campbell [Wed, 20 Apr 2011 16:13:08 +0000 (17:13 +0100)]
tools: ocaml: tweak whitespace in preparation for autogenerating xl bindings

Reduces the diff of existing vs auto-generated code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: remove create_info and build_info data types from xl bindings
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: ocaml: remove create_info and build_info data types from xl bindings

There are currently no stub functions which use these datatypes. The
existing definitions are out of date wrt the C API (and the conversion
routines are commented out anyway) and are complex from the IDL point
of view (and so will be skipped in the first round of
autogeneration). Remove them to keep things simple for now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: reorder xl bindings type and function definitions to match IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: ocaml: reorder xl bindings type and function definitions to match IDL

Reduces the churn when comparing the before and after auto-generation
versions of the patch. (in practice the ocaml pre-autogeneration
bindings are so out of date that there isn't all that much benefit to
this though...)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: reduce number of integer types in the IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: reduce number of integer types in the IDL

Remove unsigned_interger, unsigned and unsigned_long in favour of the
uintX types.

Retain the integer type as a 24 bit signed integer. This will benefit
language bindings for higher-level languages which don't support the
full machine int size.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: remove Reference meta-type from IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: remove Reference meta-type from IDL

It is tricky to map to language bindings and is now unused in any case.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: remove libxl_domain_build_state from the IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: remove libxl_domain_build_state from the IDL

This datastructure is internal to the library.

Remove the reference from libxl_device_console. This could never have
been used from outside libxl and is only used internally to add the
primary PV console to a guest. Make an internal variant of
libxl_device_console_add which takes the build state as a parameter
instead.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the topology types and functions
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: ocaml: rename the topology types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Cc: David Scott <dave.scott@eu.citrix.com>
14 years agotools: ocaml: rename the sched_credit types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the sched_credit types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the physinfo types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the physinfo types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the domain_build_state types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the domain_build_state types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
[ijc: s/Device_build_state/Domain_build_state/g]

14 years agotools: ocaml: rename the build_info types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the build_info types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the create_info types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the create_info types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: remove the domain_make and domain_build functions since they don't...
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: remove the domain_make and domain_build functions since they don't work

The actual stubs are missing so these are currently a trap for the unwary.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the pci types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the pci types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the vkb types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the vkb types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the console types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the console types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the disk_info types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the disk_info types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: ocaml: rename the device_nic types and functions
David Scott [Wed, 30 Mar 2011 17:54:28 +0000 (18:54 +0100)]
tools: ocaml: rename the device_nic types and functions

The aims are:
1. make the records instantiable if they have field names in common; and
2. to make it easier to derive the names programatically from the IDL

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: do not specify protocol node for disk or net
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: do not specify protocol node for disk or net

This node is written by the front/backends as part of their negotiation about
how to speak to each other. The toolstack has no part in this and it certainly
shouldn't be hardcoding the 32 bit protocol!

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: add concept of in- and out-put only data types to IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: add concept of in- and out-put only data types to IDL

This allow language bindings to only emit the relevant conversion functions.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: remove BitField type class from IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: remove BitField type class from IDL

All usages are single bit BitFields, AKA booleans.

In general we prefer to use simple structures (e.g. without packing or
specific layouts) in the libxl API and take care of any require
structure by marshalling within the library instead of expecting users
to do so (e.g. the PCI device BDF is unpacked in the libxl API).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: add libxl_domid to IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: add libxl_domid to IDL

Language bindings would like to strongly type the domid as a separate
type so make it a defined type.

This patch only impacts the datatypes and autogenerated destructors, I
didn't think the churn of switching the uint32_t's through the code
was worth it.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: add an Enumeration type to the IDL
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: add an Enumeration type to the IDL

The IDL requires a specific value for each enumerate, this make it
much easier to avoid (or at least track) ABI changes since they must
now be explicit.

I believe I have used the same values as would have been chosen
previoulsy but have not confirmed.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: namespace enum values within their type.
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: namespace enum values within their type.

In other words the values for an enum type libxl_foo always take the
form LIBXL_FOO_VALUE.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: generalize libxl_qemu_machine_type into libxl_domain_type
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: generalize libxl_qemu_machine_type into libxl_domain_type

The FV/PV distinction is not particular to the device model, although
that remains the only user for now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: move all enum values into the libxl namespace
Ian Campbell [Wed, 20 Apr 2011 16:13:07 +0000 (17:13 +0100)]
tools: libxl: move all enum values into the libxl namespace

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: support SeaBIOS. Use by default when upstream qemu is configured.
Ian Campbell [Wed, 20 Apr 2011 16:13:06 +0000 (17:13 +0100)]
tools: support SeaBIOS. Use by default when upstream qemu is configured.

The SeaBIOS integration here is only semi-complete and is targetted at
developers and very early adopters who can be expected to cope with
some rough edges. In particular the user must clone, patch as
necessary and compile SeaBIOS themselves since this patchset does not
cover any of that (in the same way we currently do not integrate
upstream qemu clone+build). Include a big comment to that effect next
to the Config.mk option.

Many of the bios_config callback functions are not yet used by
SeaBIOS.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: write selected BIOS to xenstore.
Ian Campbell [Wed, 20 Apr 2011 16:13:06 +0000 (17:13 +0100)]
tools: libxl: write selected BIOS to xenstore.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: hide selection of device-model by default.
Ian Campbell [Wed, 20 Apr 2011 16:13:00 +0000 (17:13 +0100)]
tools: libxl: hide selection of device-model by default.

This should never have been exposed to users as something they are
required to think about, unless they want to.

At the libxl API level:
      * Add libxl_device_model_info.device_model_version allowing the
        user to say which qemu version (e.g. old qemu-xen or qemu
        upstream) they want for a domain.
      * Add libxl_device_model_info.device_model_stubdomain allowing
        the user to select stub or non-stub device model
      * Default both the device_model field to NULL and DTRT when
        building a domain with that value in those fields, but still
        allow libxl users to specify something explicit if they want.
      * Note that libxl_device_model_info.device_model, if specified,
        must now be a complete path.

At the xl level:
      * Support a new "device_model_version" option which sets the new
        libxl_device_model_info.device_model_version field. This
        option is mandatory if device_model_override is used.
      * Support a new "device_model_stubdomain_override" option which
        allows the user to request stubdomain if desired.
      * WARN if an HVM guest cfg uses the "device_model" config
        option, and direct users to the "device_model_override" option
        if they really do not want the default. If the "device_model"
        directive contains "stubdom-db" then direct users to the
        "device_model_stubdomain_override" directive.

The default qemu remains the existing qemu-xen based qemu-dm and
stubdomain defaults to off. I chose the name "qemu-xen traditional" to
refer to the existing Xen fork of qemu and simply "qemu-xen" to refer to
the new device model based on qemu upstream.

I suspect that the vast majority of users only have these config
options because they've copied them from somewhere and they normally
have no interest in which device model is used. Renaming the fields
and warning when they are used makes these decisions internal. This
will allow us to make decisions at a platform level regarding the
preferred hvmloader, device model, stub domain etc without requiring
everyone to change their configuration files.

Adding a device model version to the API is intended to make it easy
for users to select what they need without having to know about the
paths to specific binaries etc. Most importantly it gets rid of the
parsing of the output of qemu -h...

It's not clear where upstream qemu will eventually be installed, I
went with /usr/bin/qemu for now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agotools: libxl: hide selection of hvmloader by default.
Ian Campbell [Tue, 19 Apr 2011 08:16:24 +0000 (09:16 +0100)]
tools: libxl: hide selection of hvmloader by default.

This should never have been exposed to users as something they are
required to think about, unless they want to.

At the libxl API level:
      * Move libxl_domain_build_info.kernel into the PV side of the
        tagged union (using this field to specify both PV kernel and
        hvmloader is confusing)
      * Add hvmloader (a string) to the HVM side of the tagged union.
        This defaults to NULL and libxl will DTRT with that default
        but still allow libxl users to specify something explicit if
        they want.

At the xl level:
      * WARN if an HVM guest cfg uses the "kernel" config option, and
        direct users to the "hvmloader_override" option if they really
        do not want the default hvmloader.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
14 years agocredit2: add a callback to migrate to a new cpu
George Dunlap [Wed, 27 Apr 2011 12:36:15 +0000 (13:36 +0100)]
credit2: add a callback to migrate to a new cpu

In credit2, there needs to be a strong correlation between
v->processor and the runqueue to which a vcpu is assigned;
much of the code relies on this invariant.  Allow credit2
to manage the actual migration itself.

This fixes the most recent credit2 bug reported on the list
(Xen BUG at sched_credit2.c:1606) in Xen 4.1, as well as
the bug at sched_credit2.c:811 in -unstable (which catches the
same condition earlier).

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
14 years agopv-grub: Fix for incorrect dom->p2m_host[] list initialization
Daniel Kiper [Wed, 27 Apr 2011 12:29:14 +0000 (13:29 +0100)]
pv-grub: Fix for incorrect dom->p2m_host[] list initialization

Introduction of Linux Kernel git commit
ceefccc93932b920a8ec6f35f596db05202a12fe (x86: default
CONFIG_PHYSICAL_START and CONFIG_PHYSICAL_ALIGN to 16 MB) revealed
deeply hidden bug in pv-grub. During kernel load stage dom->p2m_host[]
list has been incorrectly initialized.

At the beginning of kernel load stage dom->p2m_host[] list is
populated with current PFN->MFN layout. Later during memory allocation
(memory is allocated page by page in kexec_allocate()) page order is
changed to establish linear layout in new domain. It is done by
exchanging subsequent MFNs with newly allocated MFNs. dom->p2m_host[]
list is indexed by currently requested PFN (it is incremented from 0)
and PFN of newly allocated paged. If PFN of newly allocated page is
less than currently requested PFN then earlier allocated MFN is
overwritten which leads to domain crash later. This patch corrects
that issue. If PFN of newly allocated page is less then currently
requested PFN then relevant PFN/MFN pair is properly calculated and
usual exchange occurs later.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
14 years agolibxc: Fill in XSAVE-related CPUID leaves for PV guests.
Keir Fraser [Mon, 25 Apr 2011 14:27:56 +0000 (15:27 +0100)]
libxc: Fill in XSAVE-related CPUID leaves for PV guests.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agovtd: check and print EPT compatibility once, at boot.
Tim Deegan [Mon, 25 Apr 2011 12:17:05 +0000 (13:17 +0100)]
vtd: check and print EPT compatibility once, at boot.

Merge the check for EPT/VT-D pagetable compatibility into the other
VT-D boot-time checks.  Previously it was checking and printing many
times on each VM boot.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agoxen/x86: re-enable xsave by default now that it supports live migration.
Tim Deegan [Wed, 20 Apr 2011 11:02:51 +0000 (12:02 +0100)]
xen/x86: re-enable xsave by default now that it supports live migration.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agotools: hvmloader: attempt to SHUTDOWN_crash on BUG
Keir Fraser [Mon, 18 Apr 2011 17:34:45 +0000 (18:34 +0100)]
tools: hvmloader: attempt to SHUTDOWN_crash on BUG

Executing UD2 (invalid opcode) triggers a triple fault which signals
reboot to the toolstack, rather than crash.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
14 years agohvmloader: Fix _start-relative calculation of hypercall page address.
Keir Fraser [Mon, 18 Apr 2011 17:08:47 +0000 (18:08 +0100)]
hvmloader: Fix _start-relative calculation of hypercall page address.

We got away with it because _start-HYPERCALL_PHYSICAL_ADDRESS happens
to equal HYPERCALL_PHYSICAL_ADDRESS.

Signed-off-by: Keir Fraser <keir@xen.org>
14 years agox86/mm: Add a generic interface for vtd and amd iommu p2m sharing.
Wei Wang [Mon, 18 Apr 2011 16:24:21 +0000 (17:24 +0100)]
x86/mm: Add a generic interface for vtd and amd iommu p2m sharing.
Also introduce a new parameter (iommu=sharept) to enable this feature.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agox86/mm: Implement p2m table sharing for AMD IOMMU.
Wei Wang [Mon, 18 Apr 2011 16:24:21 +0000 (17:24 +0100)]
x86/mm: Implement p2m table sharing for AMD IOMMU.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>
14 years agox86/mm: add AMD IOMMU control bits to p2m entries.
Wei Wang [Mon, 18 Apr 2011 16:24:21 +0000 (17:24 +0100)]
x86/mm: add AMD IOMMU control bits to p2m entries.

This patch adds next levels bit into bit 9 - bit 11 of p2m entries and
adds r/w permission bits into bit 61- bit 62 of p2m entries.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
Committed-by: Tim Deegan <Tim.Deegan@citrix.com>